<!DOCTYPE html>
<html lang="en">
<!--<script src="myscript.js"></script>-->
<head>
    <meta charset="UTF-8">
    <title>js简介</title>
    <script type="text/javascript">

        document.write("<h1> 这是一个简介 </h1>")
        document.write("<h1> 这也是一个简介 </h1>")

    </script>

    <script>
        var big = "HELLO WORLD"
        var num = 2
        var whileNum = 3
        var doWhileNum = 3
        var dict = {first: 1, second: 2, third: 3}
        var myList = [1, 2, 3]


        var x;
        x = 5
        console.log(x, ++x)
        console.log(x)

        console.log(big + num)

        if (num > 0) {
            console.log("大于0")
        } else {
            console.log("小于0")
        }

        switch (num) {
            case 1:
                console.log(1);
                break;
            case 2:
                console.log(2);
                break;
            default:
                console.log(3);
        }

        var i;
        for (i = 0; i <= 10; i++) {
            console.log(i)
        }
        for (k in big) {
            console.log(big[k])
        }
        for (y in dict) {
            console.log(y, dict[y])
        }

        while (whileNum < 5) {
            console.log("这是while:", whileNum)
            whileNum += 1
        }

        do {
            console.log("这是do - while:", doWhileNum)
            doWhileNum += 1
        } while (doWhileNum < 5)

        console.log(myList.constructor.toString().indexOf("Array") > -1)

    </script>
</head>
<body>
<button type="button" onclick="alert('hello world')">点击我</button>
</body>
</html>